package com.hut.oa.model.bean;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.fasterxml.jackson.annotation.JsonIgnore;


/**
 * 日程管理表
 * @author 熊涛
 *
 */
@Entity
@Table(name="scedule_manage")
public class ScheduleManage {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="sm_id")
	private Long smId;//日程管理表id
	
	@Column(name="sm_status",nullable=false)
	private Long smStatus=0l;//日程状态表id
	
	@Column(name="sm_start_time",nullable=false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date smStartTime;//日程开始时间
	
	@Column(name="sm_end_time",nullable=false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date smEndTime;//日程结束时间
	
	@Column(name="sm_title",nullable=false)
	private String smTitle;//日程标题
	
	@Column(name="sm_content")
	private String smContent;//日程内容
	
	@Column(name="sm_send_user_id",nullable=false)
	private Long smSendUserId;//发送者id
	
	@Column(name="sm_remind",nullable=false)
	private Integer smRemind=0;//提醒
	
	@Column(name="sm_time",nullable=false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date smTime=new Date();//日程创建时间
	
	
	@JsonIgnore
	@ManyToMany(cascade=CascadeType.ALL,fetch = FetchType.LAZY)
	@JoinTable(name = "schedule_user",
	    joinColumns = {
	            @JoinColumn(name = "scedule_manage_sm_id")
	    }, inverseJoinColumns = {
	    @JoinColumn(name = "user_u_id")
	})
	private List<User> users;//通知多个用户
	
	
	
	public ScheduleManage() {}

	public Long getSmId() {
		return smId;
	}

	public void setSmId(Long smId) {
		this.smId = smId;
	}

	public Long getSmStatus() {
		return smStatus;
	}

	public void setSmStatus(Long smStatus) {
		this.smStatus = smStatus;
	}

	public Date getSmStartTime() {
		return smStartTime;
	}

	public void setSmStartTime(Date smStartTime) {
		this.smStartTime = smStartTime;
	}

	public Date getSmEndTime() {
		return smEndTime;
	}

	public void setSmEndTime(Date smEndTime) {
		this.smEndTime = smEndTime;
	}

	public String getSmTitle() {
		return smTitle;
	}

	public void setSmTitle(String smTitle) {
		this.smTitle = smTitle;
	}

	public String getSmContent() {
		return smContent;
	}

	public void setSmContent(String smContent) {
		this.smContent = smContent;
	}

	public Long getSmSendUserId() {
		return smSendUserId;
	}

	public void setSmSendUserId(Long smSendUserId) {
		this.smSendUserId = smSendUserId;
	}

	public Integer getSmRemind() {
		return smRemind;
	}

	public void setSmRemind(Integer smRemind) {
		this.smRemind = smRemind;
	}
	
	public Date getSmTime() {
		return smTime;
	}

	public void setSmTime(Date smTime) {
		this.smTime = smTime;
	}
	
	public List<User> getUsers() {
		return users;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	}

	@Override
	public String toString() {
		return "ScheduleManage [smId=" + smId + ", smStatus=" + smStatus + ", smStartTime=" + smStartTime
				+ ", smEndTime=" + smEndTime + ", smTitle=" + smTitle + ", smContent=" + smContent + ", smSendUserId="
				+ smSendUserId + ", smRemind=" + smRemind + "]";
	}
	
	
}
